<?php

/*
 * litchicms
 * Copyright (C) ${date} Author: tiefa(539247@qq.com)
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
!defined('BRK') && exit("!");

!function_exists('Component_ui_attachment') && require 'Component/optional/attachment/ui.php';

if (!function_exists('Component_ui_content')) {

    function Component_ui_content($arr=FALSE) {
        !$arr && exit('Component_ui_content');

        $input = input_rich_control('content', htmlspecialchars($arr['collection_value'], 3), 'textareaEditor');
        return "
    <div class='content_group_row'>
        <div>
            <div class='ccol1'>
                <div class='cname'><b>正文内容</b>:</div>
            </div>
        </div>
        <div class='ceditorDIV'>
            $input
        </div>
    " . Component_ui_attachment() . "
    </div>
    ";
    }

}
$BRK_GLOBAL['ComponentValidationFunction'][] = 'Component_field_content';

if (!function_exists('Component_field_content')) {

    function Component_field_content() {
        Component_ui_attachment() ;
        !key_exists('content', $_POST['field']) && exit("KEY content IS NOT EXISTS IN ARRAY \$_POST['field']");

        if (empty($_POST['field']['content'])) {
            return "内容不可以为空";
        }
        return TRUE;
    }

}